<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:winter="http://www.winter.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="/layouts/layout">
	
	<div id="FormulariosGestionFragment" th:fragment="FormulariosGestionFragment">
		<winter:output id="mainFormularioDialogOutput" class="winter-form form-container">
			<winter:output id="formFormularioDialogOutput" class="cabecera">
<!-- 				<div id="FormularioDialogForm" > -->
					<winter:row>
						<winter:column type="col-md-4">
							<winter:inputtext
								id="NuevaNatContrasena"
								label="#{label.control.formulario.contra}"
								field="*{formulario.contrasena}"
								labeldisplay="col-xs-4"
								inputdisplay="col-xs-8"
								containerdisplay="row padded"
								class="winter-input-text"
								placeholder="#{label.control.formulario.contra}"
								required="false"
								requiredimage="/images/icons/exclamation-small-red.png"
								requiredmessage="#{label.control.formulario.contra.requerido}">
							</winter:inputtext>			
						</winter:column>
						<winter:column type="col-md-4">
							<winter:inputtext
								id="NuevaNatNroCertificado"
								label="#{label.control.formulario.nroCert}"
								field="*{formulario.nroCertificado}"
								labeldisplay="col-xs-4"
								inputdisplay="col-xs-8"
								containerdisplay="row padded"
								class="winter-input-text"
								placeholder="#{label.control.formulario.nroCert}"
								required="false"
								requiredimage="/images/icons/exclamation-small-red.png"
								requiredmessage="#{label.control.formulario.nroCert.requerido}">
							</winter:inputtext>
						</winter:column>
						<winter:column type="col-md-4">
						  	<winter:select 
								id="ControlFormSelectTipoFormulario"
								field="*{formulario.formulario}" 
								collection="tipForm, rowtipForm : ${controles.tiposFormularios}"
								value="@{${tipForm.id}+'|'+${tipForm.descripcion}}"
								text="@{${tipForm.descripcion}}"
								label="#{label.control.formulario.formulario}"
								required="true"
								requiredimage="/images/icons/exclamation-small-red.png"
								requiredmessage="#{label.control.formulario.formulario.requerido}"
								modern="true" 
								showglobalmessage="true"
								addemptyvalue="true">
							</winter:select>
							<winter:event id="eventControlSelectTipoFormulario"
                                event="change"
                                target="ControlFormSelectTipoFormulario"
                                url="@{'/controles/eventTipoFormulario'}"
                                form="ControlesForm"
                                update="mainFormularioDialogOutput" object="controles" immediate="true">
                             </winter:event>
						</winter:column>
					</winter:row>
					<winter:row>
						<winter:column type="col-md-4">
							<winter:datetimepicker
								id="FechaIngreso"
								label="#{label.control.formulario.fechaIng}"
								field="*{formulario.fechaIngreso}"
								format="DD/MM/YYYY">
							</winter:datetimepicker>
			    	   </winter:column>
			    	   <winter:column type="col-md-4">
			    	   		<winter:datetimepicker
								id="FechaEmision"
								label="#{label.control.formulario.fechaEmi}"
								field="*{formulario.fechaEmision}"
								format="DD/MM/YYYY">
							</winter:datetimepicker>
			    	   </winter:column>
			    	   <winter:column type="col-md-4">
			    	   		<winter:datetimepicker
								id="FechaVencimiento"
								label="#{label.control.formulario.fechaVenc}"
								field="*{formulario.fechaVencimiento}"
								format="DD/MM/YYYY"
								disabled="true">
							</winter:datetimepicker>
			    	   </winter:column>
			    	</winter:row>
			    	<!-- <winter:row>
						<winter:column type="col-md-4">
							<winter:datetimepicker
								id="FechaRegistro"
								label="#{label.control.formulario.fechaReg}"
								field="*{formulario.fechaRegistro}"
								format="DD/MM/YYYY">
							</winter:datetimepicker>
			    	   </winter:column> 
			    	</winter:row>-->
			    	<div th:if="${controles.formulario.formulario}">
						<winter:row>
							<winter:column type="col-md-4">
							  	<winter:select 
									id="NuevoFormulSelectControlPersona"
									field="*{formulario.controlPersona}" 
									collection="conPer, rowconPer : ${controles.control.personas}"
									value="@{${conPer.id}+'|'+${conPer.idpersona}}"
									text="@{${conPer.persona.nombreCompleto}}"
									label="#{label.control.formulario.persona}"
									required="false"
									requiredimage="/images/icons/exclamation-small-red.png"
									requiredmessage="#{label.control.formulario.persona.requerido}"
									modern="true" 
									showglobalmessage="true"
									addemptyvalue="true"
									if="${controles.formulario.formulario.usePersona}">
								</winter:select>
							</winter:column>
							<winter:column type="col-md-4">
								<winter:select 
									id="NuevoFormulSelectControlVehiculo"
									field="*{formulario.controlVehiculo}" 
									collection="conVeh, rowconVeh : ${controles.control.vehiculos}"
									value="@{${conVeh.id}+'|'+${conVeh.idvehiculo}}"
									text="@{${conVeh.vehiculo.chapa}}"
									label="#{label.control.formulario.vehiculo}"
									required="false"
									requiredimage="/images/icons/exclamation-small-red.png"
									requiredmessage="#{label.control.formulario.vehiculo.requerido}"
									modern="true" 
									showglobalmessage="true"
									addemptyvalue="true"
									if="${controles.formulario.formulario.useVehiculo}">
								</winter:select>
							</winter:column>
							<winter:column type="col-md-4">
								<winter:select 
									id="NuevoFormulSelectControlNaturaleza"
									field="*{formulario.controlNaturaleza}" 
									collection="conNat, rowconNat : ${controles.control.naturalezas}"
									value="@{${conNat.id}+'|'+${conNat.idnaturaleza}}"
									text="@{${conNat.naturaleza.nombre}}"
									label="#{label.control.formulario.naturaleza}"
									required="false"
									requiredimage="/images/icons/exclamation-small-red.png"
									requiredmessage="#{label.control.formulario.naturaleza.requerido}"
									modern="true" 
									showglobalmessage="true"
									addemptyvalue="true"
									if="${controles.formulario.formulario.useNaturaleza}">
								</winter:select>
							</winter:column>
						</winter:row>
					</div>
				<winter:row class="button-panel-right" padded="true">
					<winter:ajaxSubmit 
						id="GrabarFormulario"
						form="ControlesForm"
						oncomplete="@{'Winter.ui.CloseDialog(\'FormulariosModal\')'}"
						url="@{'/controles/grabarFormulario'}"
						update="FormulariosModalOutput, FormularioOutput"
						value="#{label.operaciones.guardar}"
						class="btn btn-cyan"
						object="controles"
						showstatus="true"
						confirmationrequired="false"
						confirmationtext="Esta seguro de que desea confirmar los cambios realizados?"
						process="formFormularioDialogOutput">
					</winter:ajaxSubmit>
					<winter:ajaxSubmit 
						id="SalirFormularioButton"
						form="ControlesForm"
						oncomplete="@{'Winter.ui.CloseDialog(\'FormulariosModal\')'}"
						url="@{'/controles/cancelar/FORMULARIO'}"
						update="FormulariosModalOutput, FormularioOutput"
						value="#{label.operaciones.cancelar}"
						class="btn btn-danger"
						object="controles"
						showstatus="true"
						confirmationrequired="false"
						confirmationtext="Esta seguro de que desea descartar los cambios realizados?"
						immediate="true">
					</winter:ajaxSubmit>
				</winter:row>
<!-- 		        </div> -->
		    </winter:output>
		</winter:output>
	</div>
</html>